From d7786d4a9ec23922c139c9e70ca603f836e456d2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Javier=20Jard=C3=B3n?= Date: Sat, 24 Apr 2010 05:43:09 +0200 Subject: [PATCH] Remove GtkTree completely --- docs/reference/gtk/gtk-sections.txt | 34 --- docs/reference/gtk/gtk.types | 1 - docs/reference/gtk/tmpl/gtktree.sgml | 306 --------------------------- examples/tree/Makefile | 16 -- examples/tree/tree.c | 184 ---------------- gtk/gtk.symbols | 21 -- 6 files changed, 562 deletions(-) delete mode 100644 docs/reference/gtk/tmpl/gtktree.sgml delete mode 100644 examples/tree/Makefile delete mode 100644 examples/tree/tree.c diff --git a/docs/reference/gtk/gtk-sections.txt b/docs/reference/gtk/gtk-sections.txt index 8f040522ec..291eaa62d6 100644 --- a/docs/reference/gtk/gtk-sections.txt +++ b/docs/reference/gtk/gtk-sections.txt @@ -4290,40 +4290,6 @@ GTK_TOOLTIP gtk_tooltip_get_type -
-gtktree -GtkTree -GtkTree -GTK_IS_ROOT_TREE -GTK_TREE_ROOT_TREE -GTK_TREE_SELECTION_OLD -GtkTreeViewMode -gtk_tree_new -gtk_tree_append -gtk_tree_prepend -gtk_tree_insert -gtk_tree_remove_items -gtk_tree_clear_items -gtk_tree_select_item -gtk_tree_unselect_item -gtk_tree_select_child -gtk_tree_unselect_child -gtk_tree_child_position -gtk_tree_set_selection_mode -gtk_tree_set_view_mode -gtk_tree_set_view_lines -gtk_tree_remove_item - -GTK_TREE -GTK_IS_TREE -GTK_TYPE_TREE -GTK_TREE_CLASS -GTK_IS_TREE_CLASS -GTK_TREE_GET_CLASS - -gtk_tree_get_type -
-
gtktreeitem GtkTreeItem diff --git a/docs/reference/gtk/gtk.types b/docs/reference/gtk/gtk.types index 417fca5bfb..70ad881c4e 100644 --- a/docs/reference/gtk/gtk.types +++ b/docs/reference/gtk/gtk.types @@ -168,7 +168,6 @@ gtk_tool_item_group_get_type gtk_tool_palette_get_type gtk_tree_drag_dest_get_type gtk_tree_drag_source_get_type -gtk_tree_get_type gtk_tree_item_get_type gtk_tree_model_filter_get_type gtk_tree_model_get_type diff --git a/docs/reference/gtk/tmpl/gtktree.sgml b/docs/reference/gtk/tmpl/gtktree.sgml deleted file mode 100644 index 2cd276135d..0000000000 --- a/docs/reference/gtk/tmpl/gtktree.sgml +++ /dev/null @@ -1,306 +0,0 @@ - -GtkTree - - -A tree widget - - - - - -#GtkTree is deprecated and unsupported. It is known to be -buggy. To use it, you must define the symbol %GTK_ENABLE_BROKEN -prior to including the GTK+ header files. Use #GtkTreeView instead. - - -The #GtkTree widget is a container that shows users a list of items, in a tree format complete with branches and leafnodes. Branches can be expanded to show their child items, or collapsed to hide them. - - - - -#GtkTreeList for the items to put into a #GtkTree. - - -#GtkScrolledWindow for details on how to scroll around a #GtkTree. - - - - - - - - -struct _GtkTree -{ - GtkContainer container; - GList *children; - GtkTree* root_tree; /* owner of selection list */ - GtkWidget* tree_owner; - GList *selection; - guint level; - guint indent_value; - guint current_indent; - guint selection_mode : 2; - guint view_mode : 1; - guint view_line : 1; -}; - - - - - - -This signal is emitted by @tree whenever @widget is about to be selected. - - -@tree: the object which received the signal. -@widget: The child that is about to be selected. - - - -This signal is emitted by the root tree whenever the selection changes. - - -@tree: the object which received the signal. - - - -This signal is emitted by @tree whenever @widget is about to be unselected. - - -@tree: the object which received the signal. -@widget: The child that is about to be unselected. - - - -A macro that returns a boolean value which indicates if @obj is a root tree or not. - - -@obj: A pointer to the #GtkTree. @obj will accept any pointer, but if the pointer does not point to a #GtkTree, the results are undefined. - - - - -A macro that returns the root tree of @obj. - - -If @obj is already a root tree, @obj is cast to #GtkTree and returned. - - -@obj: A pointer to the #GtkTree. @obj will accept any pointer, but if the pointer does not point to a #GtkTree, the results are undefined. - - - - - - - -@obj: - - - - - - - -@GTK_TREE_VIEW_LINE: -@GTK_TREE_VIEW_ITEM: - - - -Creates a new #GtkTree. - - -@Returns: A pointer to the newly allocated widget. - - - - -Adds the #GtkTreeItem in @tree_item to the end of the items in @tree. - - -@tree: A pointer to a #GtkTree. -@tree_item: A pointer to the #GtkWidget that is to be appended to the tree. - - - - -Adds the #GtkTreeItem in @tree_item to the start of the items in @tree. - - -@tree: A pointer to a #GtkTree. -@tree_item: A pointer to the #GtkWidget that is to be prepended to the tree. - - - - -Adds the #GtkTreeItem in @tree_item to the list of items in @tree at the position indicated by @position. - - -@tree: A pointer to a #GtkTree. -@tree_item: A pointer to the #GtkWidget that is to be added to the tree. -@position: A #gint that indicates the position in the tree, that the @tree_item is to be added at. - - - - -Removes a list of items from the #GtkTree in @tree. - - -If only one item is to be removed from the #GtkTree, gtk_container_remove() can be used instead. - - -Removing an item from a #GtkTree dereferences the item, and thus usually destroys the item and any subtrees it may contain. If the item is not to be destroyed, use g_object_ref() before removing it. - - -@tree: A pointer to a #GtkTree. -@items: A pointer to a #GList that contains the items to be removed. - - - - -Removes the items at positions between @start and @end from the #GtkTree @tree. - - -Removing an item from a #GtkTree dereferences the item, and thus usually destroys the item and any subtrees it may contain. If the item is not to be destroyed, use g_object_ref() before removing it. - - -@tree: A pointer to a #GtkTree. -@start: A #gint. -@end: A #gint. - - - - -Emits the #select_item signal for the child at position @item, and thus selects it (unless it is unselected in a signal handler). - - -@tree: A pointer to a #GtkTree. -@item: A #gint. - - - - -Emits the #unselect_item for the child at position @item, and thus unselects it. - - -@tree: A pointer to a #GtkTree. -@item: A #gint. - - - - -Emits the #select_item signal for the child @tree_item, and thus selects it (unless it is unselected in a signal handler). - - -@tree: A pointer to a #GtkTree. -@tree_item: A pointer to the #GtkWidget that is to be selected. - - - - -Emits the #unselect_item signal for the child @tree_item, and thus unselects it. - - -@tree: A pointer to a #GtkTree. -@tree_item: A pointer to the #GtkWidget that is to be selected. - - - - -Returns the position of @child in the #GtkTree @tree. - - -If @child is not a child of @tree, then -1 is returned. - - -@tree: A pointer to a #GtkTree. -@child: A pointer to a #GtkWidget. -@Returns: A #gint. - - - - -Sets the selection mode for the #GtkTree @tree. - - -@mode can be one of - - - - -%GTK_SELECTION_SINGLE for when only one item can be selected at a time. - - - - -%GTK_SELECTION_BROWSE for when one item must be selected. - - - - -%GTK_SELECTION_MULTIPLE for when many items can be selected at once. - - - - -%GTK_SELECTION_EXTENDED Reserved for later use. - - - - -The selection mode is only defined for a root tree, as the root tree "owns" the selection. - - -The default mode is %GTK_SELECTION_SINGLE. - - -@tree: A pointer to a #GtkTree. -@mode: A #GtkSelectionMode. - - - - -Sets the 'viewmode' for the #GtkTree in @tree. The 'viewmode' defines how the tree looks when an item is selected. - - -@mode can be one of: - - - - -%GTK_TREE_VIEW_LINE : When an item is selected the entire #GtkTreeItem is highlighted. - - - - -%GTK_TREE_VIEW_ITEM : When an item is selected only the selected item's child widget is highlighted. - - - - -The default mode is %GTK_TREE_VIEW_LINE. - - -@tree: A pointer to a #GtkTree. -@mode: A #GtkTreeViewMode. - - - - -Sets whether or not the connecting lines between branches and children are drawn. - - -@tree: A pointer to a #GtkTree. -@flag: A #guint, indicating %TRUE, or %FALSE. - - - - -Removes the item @child from the #GtkTree @tree. - - -@tree: A pointer to a #GtkTree. -@child: A pointer to the #GtkWidget that is to be removed from the tree. - - diff --git a/examples/tree/Makefile b/examples/tree/Makefile deleted file mode 100644 index bbeea5992b..0000000000 --- a/examples/tree/Makefile +++ /dev/null @@ -1,16 +0,0 @@ - -CC = gcc - -#CFLAGS = -Wall \ -# -DG_DISABLE_DEPRECATED \ -# -DGDK_DISABLE_DEPRECATED \ -# -DGDK_PIXBUF_DISABLE_DEPRECATED \ -# -DGTK_DISABLE_DEPRECATED - -CFLAGS = - -tree: tree.c - $(CC) tree.c -o tree $(CFLAGS) `pkg-config gtk+-2.0 --cflags --libs` - -clean: - rm -f *.o tree diff --git a/examples/tree/tree.c b/examples/tree/tree.c deleted file mode 100644 index 01064f46af..0000000000 --- a/examples/tree/tree.c +++ /dev/null @@ -1,184 +0,0 @@ - -#define GTK_ENABLE_BROKEN -#include "config.h" -#include - -/* for all the GtkItem:: and GtkTreeItem:: signals */ -static void cb_itemsignal( GtkWidget *item, - gchar *signame ) -{ - const gchar *name; - GtkLabel *label; - - /* It's a Bin, so it has one child, which we know to be a - label, so get that */ - label = GTK_LABEL (gtk_bin_get_child (GTK_BIN (item))); - /* Get the text of the label */ - name = gtk_label_get_text (label); - /* Get the level of the tree which the item is in */ - g_print ("%s called for item %s->%p, level %d\n", signame, name, - item, GTK_TREE (item->parent)->level); -} - -/* Note that this is never called */ -static void cb_unselect_child( GtkWidget *root_tree, - GtkWidget *child, - GtkWidget *subtree ) -{ - g_print ("unselect_child called for root tree %p, subtree %p, child %p\n", - root_tree, subtree, child); -} - -/* Note that this is called every time the user clicks on an item, - whether it is already selected or not. */ -static void cb_select_child (GtkWidget *root_tree, GtkWidget *child, - GtkWidget *subtree) -{ - g_print ("select_child called for root tree %p, subtree %p, child %p\n", - root_tree, subtree, child); -} - -static void cb_selection_changed( GtkWidget *tree ) -{ - GList *i; - - g_print ("selection_change called for tree %p\n", tree); - g_print ("selected objects are:\n"); - - i = GTK_TREE_SELECTION_OLD (tree); - while (i) { - const gchar *name; - GtkLabel *label; - GtkWidget *item; - - /* Get a GtkWidget pointer from the list node */ - item = GTK_WIDGET (i->data); - label = GTK_LABEL (gtk_bin_get_child (GTK_BIN (item))); - name = gtk_label_get_text (label); - g_print ("\t%s on level %d\n", name, GTK_TREE - (item->parent)->level); - i = i->next; - } -} - -int main( int argc, - char *argv[] ) -{ - GtkWidget *window, *scrolled_win, *tree; - static gchar *itemnames[] = {"Foo", "Bar", "Baz", "Quux", - "Maurice"}; - gint i; - - gtk_init (&argc, &argv); - - /* a generic toplevel window */ - window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - g_signal_connect (G_OBJECT (window), "delete_event", - G_CALLBACK (gtk_main_quit), NULL); - gtk_container_set_border_width (GTK_CONTAINER (window), 5); - - /* A generic scrolled window */ - scrolled_win = gtk_scrolled_window_new (NULL, NULL); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win), - GTK_POLICY_AUTOMATIC, - GTK_POLICY_AUTOMATIC); - gtk_widget_set_size_request (scrolled_win, 150, 200); - gtk_container_add (GTK_CONTAINER (window), scrolled_win); - gtk_widget_show (scrolled_win); - - /* Create the root tree */ - tree = gtk_tree_new (); - g_print ("root tree is %p\n", tree); - /* connect all GtkTree:: signals */ - g_signal_connect (G_OBJECT (tree), "select_child", - G_CALLBACK (cb_select_child), tree); - g_signal_connect (G_OBJECT (tree), "unselect_child", - G_CALLBACK (cb_unselect_child), tree); - g_signal_connect (G_OBJECT(tree), "selection_changed", - G_CALLBACK(cb_selection_changed), tree); - /* Add it to the scrolled window */ - gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_win), - tree); - /* Set the selection mode */ - gtk_tree_set_selection_mode (GTK_TREE (tree), - GTK_SELECTION_MULTIPLE); - /* Show it */ - gtk_widget_show (tree); - - for (i = 0; i < 5; i++){ - GtkWidget *subtree, *item; - gint j; - - /* Create a tree item */ - item = gtk_tree_item_new_with_label (itemnames[i]); - /* Connect all GtkItem:: and GtkTreeItem:: signals */ - g_signal_connect (G_OBJECT (item), "select", - G_CALLBACK (cb_itemsignal), "select"); - g_signal_connect (G_OBJECT (item), "deselect", - G_CALLBACK (cb_itemsignal), "deselect"); - g_signal_connect (G_OBJECT (item), "toggle", - G_CALLBACK (cb_itemsignal), "toggle"); - g_signal_connect (G_OBJECT (item), "expand", - G_CALLBACK (cb_itemsignal), "expand"); - g_signal_connect (G_OBJECT (item), "collapse", - G_CALLBACK (cb_itemsignal), "collapse"); - /* Add it to the parent tree */ - gtk_tree_append (GTK_TREE (tree), item); - /* Show it - this can be done at any time */ - gtk_widget_show (item); - /* Create this item's subtree */ - subtree = gtk_tree_new (); - g_print ("-> item %s->%p, subtree %p\n", itemnames[i], item, - subtree); - - /* This is still necessary if you want these signals to be called - for the subtree's children. Note that selection_change will be - signalled for the root tree regardless. */ - g_signal_connect (G_OBJECT (subtree), "select_child", - G_CALLBACK (cb_select_child), subtree); - g_signal_connect (G_OBJECT (subtree), "unselect_child", - G_CALLBACK (cb_unselect_child), subtree); - /* This has absolutely no effect, because it is completely ignored - in subtrees */ - gtk_tree_set_selection_mode (GTK_TREE (subtree), - GTK_SELECTION_SINGLE); - /* Neither does this, but for a rather different reason - the - view_mode and view_line values of a tree are propagated to - subtrees when they are mapped. So, setting it later on would - actually have a (somewhat unpredictable) effect */ - gtk_tree_set_view_mode (GTK_TREE (subtree), GTK_TREE_VIEW_ITEM); - /* Set this item's subtree - note that you cannot do this until - AFTER the item has been added to its parent tree! */ - gtk_tree_item_set_subtree (GTK_TREE_ITEM (item), subtree); - - for (j = 0; j < 5; j++){ - GtkWidget *subitem; - - /* Create a subtree item, in much the same way */ - subitem = gtk_tree_item_new_with_label (itemnames[j]); - /* Connect all GtkItem:: and GtkTreeItem:: signals */ - g_signal_connect (G_OBJECT (subitem), "select", - G_CALLBACK (cb_itemsignal), "select"); - g_signal_connect (G_OBJECT (subitem), "deselect", - G_CALLBACK (cb_itemsignal), "deselect"); - g_signal_connect (G_OBJECT (subitem), "toggle", - G_CALLBACK (cb_itemsignal), "toggle"); - g_signal_connect (G_OBJECT (subitem), "expand", - G_CALLBACK (cb_itemsignal), "expand"); - g_signal_connect (G_OBJECT (subitem), "collapse", - G_CALLBACK (cb_itemsignal), "collapse"); - g_print ("-> -> item %s->%p\n", itemnames[j], subitem); - /* Add it to its parent tree */ - gtk_tree_append (GTK_TREE (subtree), subitem); - /* Show it */ - gtk_widget_show (subitem); - } - } - - /* Show the window and loop endlessly */ - gtk_widget_show (window); - - gtk_main(); - - return 0; -} diff --git a/gtk/gtk.symbols b/gtk/gtk.symbols index f8c0d8d749..d5837b23a5 100644 --- a/gtk/gtk.symbols +++ b/gtk/gtk.symbols @@ -3828,27 +3828,6 @@ gtk_tray_icon_get_type G_GNUC_CONST #endif #endif -#if IN_HEADER(__GTK_TREE_H__) -#if IN_FILE(__GTK_TREE_C__) -gtk_tree_append -gtk_tree_child_position -gtk_tree_clear_items -gtk_tree_get_type G_GNUC_CONST -gtk_tree_insert -gtk_tree_prepend -gtk_tree_remove_item -gtk_tree_remove_items -gtk_tree_select_child -gtk_tree_select_item -gtk_tree_set_selection_mode -gtk_tree_set_view_lines -gtk_tree_set_view_mode -gtk_tree_unselect_child -gtk_tree_unselect_item -gtk_tree_new -#endif -#endif - #if IN_HEADER(__GTK_TREE_DND_H__) #if IN_FILE(__GTK_TREE_DND_C__) gtk_tree_drag_dest_drag_data_received -- 2.30.2